package torres.action;

import java.util.Collection;

import torres.entity.Entity;
import torres.map.Location;
import torres.map.World;

/**
 * @author Shaun
 * Actions with an influence radius of 360 degrees
 *
 */
public class RadialAction extends Action {
	
	/**
	 * Creates a new RadialAction
	 * @param elem Elemental type of RadialAction
	 * @param range range of RadialAction
	 * @param power power damage of RadialAction
	 * @param accuracy accuracy of RadialAction
	 * @param delay Time delay of consecutive RadialAction
	 */
	public RadialAction(Effect elem, int range, int power, int accuracy, int delay) {
		super(elem, range, power, accuracy, delay);
	}
	
	/**
	 * Creates a new RadialAction
	 * @param elem Elemental type of RadialAction
	 * @param range range of RadialAction
	 * @param location location of RadialAction
	 * @param power power damage of RadialAction
	 * @param accuracy accuracy of RadialAction
	 * @param delay Time delay of consecutive RadialAction
	 */
	public RadialAction(Effect elem, int range, Location location, int power, int accuracy, int delay) {
		super(elem, range, location, power, accuracy, delay);
	}

	/**
	 * Returns a collection of Locations
	 * @return Collection of Locations
	 * @see torres.action.Action#getLocations()
	 */
	protected Collection<Collection<Location>> getLocations() {
		return Location.radialCollection(this.getLocation(), this.getRange());
	}
	
	/**
	 * Sets up the origin of RadialAction 
	 * @param e new Entity used as reference to set
	 */
	public void setUp(Entity e) {
		this.setMap(World.getInstance().getCurrentMap());
		this.setLocation(e.getLocation());
		double multiplier = e.getOccupation().applySkill(this.getElement());
		this.setPower((int)(this.getPower() * multiplier));
		this.setAccuracy((int)(this.getAccuracy() * multiplier));
	}
}
